home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '90 / MacHack 90 Contest Entries / DragWindow by Ricardo ƒ / DragW INIT.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-15  |  942 b   |  32 lines  |  [TEXT/MPS ]

  1. #include "Types.h"
  2. #include "QuickDraw.h"
  3. #include "Windows.h"
  4. #include "Memory.h"
  5. #include "Resources.h"
  6. // NewDragWindow INIT, Copyright © 1990 Ricardo Batista
  7. // This code gets executed during system startup, its the purpose is to
  8. // load our DragWindow replacement routine so that a window is moved
  9. // along with it's contents as supposed to moving around an outline only.
  10. //
  11. // This code is for MPW C 3.1, should be compiled into an INIT resource.
  12. //
  13. // After compiling copy this resource into a file that includes DragW 'DrgW'
  14. //
  15.  
  16.  
  17. #include "OSUtils.h"
  18.  
  19.  
  20. void main(void)
  21. {
  22.     Handle H;
  23.     
  24.     H = GetResource('DrgW',-4033);                        // get our patch resource
  25.     if (H) {
  26.         LoadResource(H);                                // make sure is loaded
  27.         DetachResource(H);                                // not a resource anymore
  28.         HLock(H);                                        // make sure is locked
  29.         HNoPurge(H);                                    // make sure is not purgeable
  30.         NSetTrapAddress((long) *H, 0xA925, ToolTrap);    // replace old trap code
  31.     }
  32. }